#include "tah.h"

Tah::Tah()
{
    x= new quint16(0);
    y= new quint16(0);
}

Tah::Tah(quint16 x, quint16 y)
{
    this->x=new quint16(x);
    this->y=new quint16(y);
}

Tah::Tah(const Tah &other)
{
    x=new quint16(*other.x);
    y = new quint16(*other.y);
}

Tah::Tah(QDataStream &in)
    : x(new quint16)
    , y(new quint16)
{
    this->unserialize(in);
}

Tah::~Tah()
{
    delete x;
    delete y;
}

quint16 * Tah::getX()
{
    return x;
}

quint16 * Tah::getY()
{
    return y;
}

bool Tah::operator== ( const Tah & other ) const
{
    return (*this->x==*other.x && *this->y==*other.y)?1:0;
}

void Tah::serialize(QDataStream &ost)
{
    ost << *this->x << *this->y;
}

void Tah::unserialize(QDataStream &str)
{
    str >> *this->x >> *this->y;
}


QDataStream& Tah::operator<<(QDataStream &in)
{
    this->serialize(in);
    return in;
}


QDataStream& Tah::operator>>(QDataStream &str)
{
    this->unserialize(str);
    return str;
}
